﻿using Learun.Util;
using SqlSugar;
using System;
using System.Collections.Generic;

namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-03-07 13:44
    /// 描 述：工程数据表
    /// </summary>
    [SugarTable(TableName = "ec_enginedata")]
    public class ec_enginedataEntity
    {
        public ec_enginedataEntity()
        {
            CaseID = "0";
        }
        #region 实体成员
        /// <summary>
        /// 工程数据ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public string EngineDataID { get; set; }
        /// <summary>
        /// 位号
        /// </summary>
        public string TagNumber { get; set; } = "";
        /// <summary>
        /// 对象类型ID。<see cref="ec_objecttypeEntity.ObjectTypeID"/>"/>
        /// </summary>
        public string ObjectTypeID { get; set; } = "";

        /// <summary>
        /// 查询时，为该位号当前激活的case。
        /// 更新提交时，为该位号需要修改的case。<see cref="ec_CaseEntity.CaseID"/>
        /// </summary>
        public string CaseID { get; set; } = "0";
        /// <summary>
        /// 数据状态
        /// </summary>
        public string DataStatus { get; set; } = "";
        /// <summary>
        /// 流水号
        /// </summary>
        /// <returns></returns>
        public int? SerialNumber { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.EngineDataID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.EngineDataID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion
        #region 扩展字段
        /// <summary>
        /// 对象类型名称
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string ObjectTypeName { get; set; } = "";

        /// <summary>
        /// 连接的电缆，主要用于UpdatePixelAndProp方法
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<string> connected_cables { set; get; }
        /// <summary>
        /// 针对电缆而言，它的平行电缆
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ec_parallel_CableEntity> parallel_cables { set; get; }
        /// <summary>
        /// 工程数据图元集合
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ec_enginedata_pixelEntity> EngineDataPixel { get; set; }

        /// <summary>
        /// 工程数据属性集合
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ec_enginedata_propertyEntity> EngineDataProperty { get; set; }

        /// <summary>
        /// 数据状态名称
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string DataStatusName { get; set; }
        /// <summary>
        /// 对象类型完整路径 中文
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string FullPathCN { get; set; }
        /// <summary>
        /// 对象类型名称(英文)
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string ObjectTypeNameEN { get; set; }

        /// <summary>
        /// 布置图的块对象
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public ec_library_fileEntity Layout_Block_File { get; set; }


        #endregion
    }
}

